package com.example.ddcoursequery;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;

import com.app.model.Course;

import java.util.ArrayList;
import java.util.List;

public class ShowCourseActivity extends Activity {
    private ViewPager viewPager;
    private List<List<AppCourse>> viewList;
    private List<String> titleList;
    private PagerTabStrip tab;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_showcourse);
        viewPager = (ViewPager) findViewById(R.id.pager);
        titleList = CacheTeacher.titleList;

        tab = (PagerTabStrip) findViewById(R.id.tab);
        tab.setTabIndicatorColor(getResources().getColor(android.R.color.holo_green_light));
        tab.setDrawFullUnderline(false);

        viewList = CacheTeacher.courseList;
        MyViewPagerAdapter adapter = new MyViewPagerAdapter(ShowCourseActivity.this, viewList, titleList);
        viewPager.setAdapter(adapter);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_showcourse, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
